package com.example.livemall.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class SearchResult implements Serializable {

    private int code;

    private Boolean hasMore;

    private Object data;

    private String msg;

    public static SearchResult success(Boolean hasMore, Object data) {
        return new SearchResult(200, hasMore, data, null);
    }


    public static SearchResult success(String msg, Object data) {
        return new SearchResult(200, null, data, msg);
    }

    public static SearchResult error() {
        return new SearchResult(500, null, null, "请求失败");
    }

}
